package com.fg.pro.model.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fg.pro.model.config.ValidationGroups;
import com.fg.pro.model.entity.BaseEntity;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 用户(SysUser)表实体类
 *
 * @author makejava
 * @since 2025-07-17 10:10:47
 */
@SuppressWarnings("serial")
@Data
//public class SysUser extends Model<SysUser> {
public class SysUser extends BaseEntity {
    //主键id
    private Long id;
    //账号
    @NotEmpty(message = "用户账号名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    @Size(message = "用户账号名称字符长度大于2，小于20", max = 20, min = 2, groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private String userAccount;
    //密码
    @NotEmpty(message = "用户密码不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    @Size(message = "用户密码字符长度大于2，小于20", max = 20, min = 2, groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private String userPassword;
    //用户名
    @NotEmpty(message = "用户名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    @Size(message = "用户名称字符长度大于2，小于20", max = 20, min = 2, groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private String userName;
    //昵称
    private String userNikename;
    //状态（0-禁用，1-正常）
    private Integer userState;
    //电话
    private String userTel;
    //等级
    private Integer userLev;
    //部门id
    private Long deptId;
    //部门名称
    @TableField(exist = false)
    private String deptName;

//    private Date createTime;
//    private Date updateTime;


    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }
}

